﻿//using Microsoft.Extensions.Logging;
using Prism.Events;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Windows;
//using Xcj.Mes.Core.Logger;

namespace Xcj.Mes.WholeLine.ZH.HG.Shell.ViewModels
{
    public class BaseViewModel : BindableBase, IDisposable
    {
        //protected DebugLogger _logger { get; private set; }

        protected IRegionManager _regionManager { get; private set; }

        protected IEventAggregator _eventAggregator { get; private set; }

        public BaseViewModel() : this(null) { }

        public BaseViewModel(IRegionManager regionManager)
        {
            if (regionManager == null)
                _regionManager = ((Prism.PrismApplicationBase)System.Windows.Application.Current).Container.Resolve<IRegionManager>();
            else
                _regionManager = regionManager;

            // 日志
            //_logger = (DebugLogger)((Prism.PrismApplicationBase)System.Windows.Application.Current).Container.Resolve<ILogger>();

            // 订阅事件
            _eventAggregator = ((Prism.PrismApplicationBase)Application.Current).Container.Resolve<IEventAggregator>();
        }

        public virtual void Dispose()
        {

        }
    }
}
